(function(window) {
  let baseUrl = 'http://portal.wccg.tech:9001';
  let params = new URL(document.location).searchParams;
  let id = params.get('i');

  const projectToCameraLayer = {
    '1296256020068786178':
      'https://portal.wccg.tech:9002/to443/server1/rest/services/Hosted/CameraWuxiTest/FeatureServer', // 无锡
    '1308246635895685122':
      'https://portal.wccg.tech:9002/to443/server1/rest/services/%E7%9B%91%E6%8E%A7%E7%82%B9%E4%BD%8D/MapServer/2', //312
    '1308254822183043073':
      'https://portal.wccg.tech:9002/to443/server1/rest/services/%E7%9B%91%E6%8E%A7%E7%82%B9%E4%BD%8D/MapServer/2', //312
    '1308241434249887746':
      'https://portal.wccg.tech:9002/to443/server1/rest/services/%E7%9B%91%E6%8E%A7%E7%82%B9%E4%BD%8D/MapServer/3', //高浪路
  };

  let projectToLiveStreamList = {
    // '1296256020068786178': [
    //   // 宜马通道
    //   '弱电房门口1',
    //   '弱电房门口2',
    //   '项目宿舍楼1',
    //   '三厂钢筋大棚东',
    //   '搅拌站楼顶',
    //   '项目宿舍楼2',
    //   '项目宿舍楼3',
    //   '雪云路保安室',
    // ].map((deviceName, index) => {
    //   let i = index + 1;
    //   return {
    //     channelNo: i, // 设备频道编号i
    //     deviceName, // 设备名称
    //     // liveAddress: `https://open.ys7.com/v3/openlive/G01826717_1_1.m3u8?expire=1654311051&id=322688994778292224&t=81e6f7df61f348cfbde74bcef408fbdd7539174ab4f803c84732f2b526227b67&ev=100`, // 直播地址
    //     liveAddress: `${baseUrl}/hikhls/stream${i}.m3u8`, // 直播地址
    //   };
    // }),
    '1296256020068786178': [
      // 宜马通道
      {
        channelNo: 1, // 设备频道编号i
        deviceName: '弱电房门口1', // 设备名称
        liveAddress:
          'https://open.ys7.com/v3/openlive/E03869214_1_1.m3u8?expire=1659923046&id=346227405251944448&t=32735e294accf877f5e84bdfd82149ab10cdc891858bec57bec3296454c81b6c&ev=100',
      },
      {
        channelNo: 2, // 设备频道编号i
        deviceName: '弱电房门口2', // 设备名称
        liveAddress:
          'https://open.ys7.com/v3/openlive/E03869214_2_1.m3u8?expire=1659927297&id=346245238357200896&t=72476230b900e452ac5d6cfc16ae636fb1cc11e183d4f0af9946ad440c581aed&ev=100',
      },
      {
        channelNo: 3, // 设备频道编号i
        deviceName: '项目宿舍楼1', // 设备名称
        liveAddress:
          'https://open.ys7.com/v3/openlive/E03869214_3_1.m3u8?expire=1659927345&id=346245439238926336&t=4a49c529158da53bbb7963c608af9488fdae5b823396b6f71af512f8307746d6&ev=100',
      },
      {
        channelNo: 4, // 设备频道编号i
        deviceName: '三厂钢筋大棚东', // 设备名称
        liveAddress:
          'https://open.ys7.com/v3/openlive/E03869214_4_1.m3u8?expire=1659928039&id=346248350846935040&t=d7379d21534cfa6aece61929b40665b489154136f912eb79ed412540856bda04&ev=100',
      },
      {
        channelNo: 5, // 设备频道编号i
        deviceName: '搅拌站楼顶', // 设备名称
        liveAddress:
          'https://open.ys7.com/v3/openlive/E03869214_5_1.m3u8?expire=1659928180&id=346248941206884352&t=faa0b84ae53d3a33a24ff7d03fe46f091da771b1ed856f544529ea789b11aeee&ev=100',
      },
      {
        channelNo: 6, // 设备频道编号i
        deviceName: '项目宿舍楼2', // 设备名称
        liveAddress:
          'https://open.ys7.com/v3/openlive/E03869214_6_1.m3u8?expire=1659928210&id=346249065039192064&t=ae1897db79fd44cb1d93f24b9b89cb44e174afc9885b4406d8068cddae33383c&ev=100',
      },
      {
        channelNo: 7, // 设备频道编号i
        deviceName: '项目宿舍楼3', // 设备名称
        liveAddress:
          'https://open.ys7.com/v3/openlive/E03869214_7_1.m3u8?expire=1659928279&id=346249354929373184&t=d75bf6502effda9554855552bd688e5f06bedd72fc625cba98732d659d9caf0b&ev=100',
      },
      {
        channelNo: 8, // 设备频道编号i
        deviceName: '雪云路保安室', // 设备名称
        liveAddress:
          'https://open.ys7.com/v3/openlive/E03869214_8_1.m3u8?expire=1659928319&id=346249522942189568&t=5aef6bb134b2a1933c36a4eba43aa2c60ea5211b7ec5526cac7f7be8dd805f80&ev=100',
      },
    ],

    '1308246635895685122': [
      // 312道路
      {
        channelNo: 1,
        deviceName: '桥梁2队：通江大道',
        liveAddress: `https://open.ys7.com/v3/openlive/G01826717_1_1.m3u8?expire=1691303476&id=477846469534023680&t=862e22043c5619e928b6621bda1173228e72df2da65f4a099497bfbbf34c30cd&ev=100`, // 直播地址
      },
      {
        channelNo: 2,
        deviceName: '桥梁2队：扬州商会',
        liveAddress: `https://open.ys7.com/v3/openlive/G01826717_2_1.m3u8?expire=1691303627&id=477847101703725056&t=e69678b23184482800f617221bf1edbf772af7a7846d9035cf1c454ec1f8812b&ev=100`, // 直播地址
      },
      {
        channelNo: 3,
        deviceName: '桥梁1队：中原路',
        liveAddress: `https://open.ys7.com/v3/openlive/G01826717_3_1.m3u8?expire=1691303573&id=477846878608687104&t=9e57a550563958c27d01d052a7f8755253b93a5f0fe49d54c40d757ad2fc871b&ev=100`, // 直播地址
      },
      {
        channelNo: 4,
        deviceName: '桥梁1队：严埭港桥',
        liveAddress: `https://open.ys7.com/v3/openlive/G01826717_4_1.m3u8?expire=1691303602&id=477846996871290880&t=10bf07c5a11702f9e579fb637fee4413a166fbd371b5138681636bef13f84557&ev=100`, // 直播地址
      },
    ],

    '1308241434249887746': [
      // 高浪路
      {
        channelNo: 1, // 设备频道编号i
        deviceName: '华清大道西', // 设备名称
        // liveAddress: `${baseUrl}/hikhls/stream9.m3u8`, // 直播地址
        liveAddress: `https://open.ys7.com/v3/openlive/G04728748_1_1.m3u8?expire=1657354987&id=335456187518627840&t=6e50638d5e4a79962b9e104be523389b9fb2f0ffe04e0532ec99323fe420bd7b&ev=100`, // 直播地址
      },
      {
        channelNo: 2, // 设备频道编号i
        deviceName: '华清大道东', // 设备名称
        // liveAddress: `${baseUrl}/hikhls/stream10.m3u8`, // 直播地址
        liveAddress: `https://open.ys7.com/v3/openlive/G04728748_2_1.m3u8?expire=1657355214&id=335457141260517376&t=0a358ac5c5bdb13e23294f9aba225b707b3a428cb9758daf76abfa5e394bc6d4&ev=100`, // 直播地址
      },
      {
        channelNo: 3, // 设备频道编号i
        deviceName: '华谊路东', // 设备名称
        // liveAddress: `${baseUrl}/hikhls/stream11.m3u8`, // 直播地址
        liveAddress: `https://open.ys7.com/v3/openlive/G04728748_3_1.m3u8?expire=1657417300&id=335717546162298880&t=92ff8d0514c083b8134c666012234d31657d0101b9ac319f65482bc02b0aa9d1&ev=100`, // 直播地址
      },
      {
        channelNo: 4, // 设备频道编号i
        deviceName: '华谊路西', // 设备名称
        // liveAddress: `${baseUrl}/hikhls/stream12.m3u8`, // 直播地址
        liveAddress: `https://open.ys7.com/v3/openlive/G04728748_4_1.m3u8?expire=1657417358&id=335717789474197504&t=103390e064c3d1db8a3486c9b563ce10a1f041ab6b5afd245639f02d0c39dd6c&ev=100`, // 直播地址
      },
    ],
  };

  projectToLiveStreamList['1308254822183043073'] = projectToLiveStreamList['1308246635895685122']; // 311路

  window.projectToLiveStreamList = projectToLiveStreamList;
  window.liveStreamList = projectToLiveStreamList[id] || [];
  window.cameraLayerUrl = projectToCameraLayer[id];
})(window);
